package com.cty.servlet.servlet5;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.io.IOException;

/**
 * @Auther: cty
 * @Date: 2020/2/12 10:25
 * @Description:
 * @version: 1.0
 */
@WebServlet(name = "SessionServlet2")
public class SessionServlet2 extends HttpServlet {
    @Override
    protected void service(HttpServletRequest req, HttpServletResponse resp)
            throws ServletException, IOException {
        HttpSession hs=req.getSession();
        System.out.println("SessionServlet2.service()"+hs.getId());
        System.out.println("SessionServlet2.service()"+hs.getAttribute("name"));
    }
}

/*
SessionServlet2.service()505EFF0D83E74488214087C318AA01B2
SessionServlet2.service()张三
*/
